#import "BWMetadataWindowController.h"

static BWMetadataWindowController *g_controller;

@implementation BWMetadataWindowController

- (void) setDocument: (NSDocument *) document
{
    [super setDocument: document];

    // update inspector
    [metadataObjectController
        setContent: [document valueForKey: @"metadata"]];

    if (document == nil) {
        [[self window] setTitle: @"Document Information Inspector"];
    }

} // setDocument


- (NSString *) windowTitleForDocumentDisplayName: (NSString *) displayName
{
    NSString *string;

    string = [NSString stringWithFormat: @"Information for %@", displayName];
    return (string);

} // windowTitleForDocumentDisplayName


+ (NSString *) autosaveName
{
    return (@"informationWindow");
} // autosaveName


+ (BWWindowController *) sharedInstance
{
    return (g_controller);
} // sharedInstance


+ (void) setSharedInstance: (BWWindowController *) controller
{
    assert ([[controller class] isSubclassOfClass: self]);

    g_controller = (BWMetadataWindowController *)controller;

} // setShraedInstance


+ (BWMetadataWindowController *) sharedController
{
    return ((BWMetadataWindowController*)[super sharedController]);
} // sharedController



+ (NSString *) windowNibName
{
    return (@"BWMetadataWindow");
} // windowNibName



@end // BWMetadataWindowController

